# $Id: PKGBUILD 87021 2013-03-25 19:17:03Z bpiotrowski $
# Maintainer: Felix Yan <felixonmars@gmail.com>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Neil Lin <neil@vip.url.com.tw>
# Contributor: Cravix < dr dot neemous at gmail dot com >

pkgbase=stardict
pkgname=(stardict stardict-lite)
pkgver=3.0.4
pkgrel=3
arch=('i686' 'x86_64')
url='http://www.stardict.org/'
license=('GPL')
makedepends=('intltool' 'popt' 'gnome-doc-utils' 'gnome-common' 'libmariadbclient' 'enchant' 'gtk2' 'libsigc++' 'libsm' 'espeak' 'libgnome')
options=('!libtool' '!emptydirs')
source=("http://stardict-3.googlecode.com/files/${pkgbase}-${pkgver}.tar.bz2"
        'gcc46.patch'
        'glib2.patch'
        'zlib.patch')

build() {
  cd "${srcdir}/${pkgbase}-${pkgver}"

  patch -p1 -i ../gcc46.patch
  patch -p1 -i ../glib2.patch
  patch -p1 -i ../zlib.patch

  cp -r "${srcdir}/${pkgbase}-${pkgver}" "${srcdir}/${pkgbase}-${pkgver}-lite"

  cd "${srcdir}/${pkgbase}-${pkgver}"
  ./configure \
    PKG_CONFIG=/usr/bin/pkg-config \
    --prefix=/usr \
    --sysconfdir=/etc \
    --mandir=/usr/share/man \
    --disable-schemas-install \
    --disable-gucharmap \
    --disable-festival \
    --disable-updateinfo
  make

  cd "${srcdir}/${pkgbase}-${pkgver}-lite"
  LDFLAGS="$LDFLAGS -lgmodule-2.0"
  ./configure \
    PKG_CONFIG=/usr/bin/pkg-config \
    --prefix=/usr \
    --sysconfdir=/etc \
    --mandir=/usr/share/man \
    --disable-gnome-support \
    --disable-schemas-install \
    --disable-espeak \
    --disable-gucharmap \
    --disable-festival \
    --disable-updateinfo
  make
}

package_stardict() {
  pkgdesc='International dictionary software'
  depends=('enchant' 'gtk2' 'libsigc++' 'libsm' 'espeak' 'libgnome')

  cd "${srcdir}/${pkgbase}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}

package_stardict-lite() {
  pkgdesc='International dictionary software - lite version without gnome and espeak support'
  depends=('enchant' 'gtk2' 'libsigc++' 'libsm')
  provides=(stardict)
  conflicts=(stardict)

  cd "${srcdir}/${pkgbase}-${pkgver}-lite"
  make DESTDIR="${pkgdir}" install
}

md5sums=('0a9abf1936c43a3ee255802c75267f1a'
         '52ff47441c503de07add4b7688510bc5'
         'b2f216897c9053c7e4666c3d78705cf1'
         'ee26dce70fc83b3ce86e5100fede7fad')
